package view.main;

import model.world.CSMap;

public class MainThread implements Runnable {

	private CSMap map;
	private boolean mapFound;
	
	public static void main(String[] args) {
		new Thread(new MainThread()).start();
	}

	public void run() {
		mapFound = false;
		
		Starter mapChooser = new Starter(this);
		mapChooser.display();
		
		while (!mapFound) {
			try {
				wait(100);
			}
			catch (InterruptedException e) {}
		}

		if (map == null)
			return;
		
		new MainPanel(map.getMapImage(),map.getMapFile()).display();
	}
	
	public void setMap(CSMap map_) {
		map = map_;
		mapFound = true;
	}
}
